package com.twu.biblioteca.Models;

/**
 * User: haruo
 * Date: 5/17/13
 */
public class Book {
    private String ISBN;
    private String title;
    private String author;
    private int year;
    private int quantity;

    public Book(String ISBN, String title, String author, int year, int quantity) {
        this.ISBN = ISBN;
        this.title = title;
        this.author = author;
        this.year = year;
        this.quantity = quantity;
    }

    public String getISBN() {
        return ISBN;
    }

    public void setISBN(String ISBN) {
        this.ISBN = ISBN;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public String getTitle() {

        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public boolean reserve() {
        if (this.quantity > 0) {
            this.quantity -= 1;
            return true;
        } else {
            return false;
        }
    }

    @Override
    public String toString() {
        return this.ISBN + "\t\t" + this.title + "\t\t" +
                this.author + "\t\t" + this.quantity + "\n";
    }
}
